﻿// See https://aka.ms/new-console-template for more information

using P5_ToItem;

TodoItemManager manager = new TodoItemManager();
short option = -1;
do
{
    Console.Clear();
    Console.WriteLine("备忘录管理系统");
    Console.WriteLine("1.查看所有备忘");
    Console.WriteLine("2.添加备忘");
    Console.WriteLine("3.标记完成");
    Console.WriteLine("4.删除备忘");
    Console.WriteLine("0.退出系统");
    Console.WriteLine();
    Console.WriteLine("请输入你的选择：");
    string? userInput = Console.ReadLine();
    if (!Int16.TryParse(userInput, out  option))
    {
        Console.WriteLine("请输入正确的选项~");
        continue;
    }

    string? title = "";
    switch (option)
    {
        case 1:
            manager.ShowAllItems();
            break;
        case 2:
            Console.WriteLine("输入标题：");
            title = Console.ReadLine();
            Console.WriteLine("输入标题：");
            string? description = Console.ReadLine();
            Console.WriteLine("输入标题：");
            manager.AddTodoItem(title,description,false);
            break;
        case 3:
            Console.WriteLine("请输入标题：");
            title = Console.ReadLine();
            manager.MarkComplete(title);
            break;
        case 4:
            Console.WriteLine("请输入标题：");
            title = Console.ReadLine();
            manager.DeleteItem(title);
            break;
    }

    Console.ReadKey();
}while(option != 0);